﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework;

namespace MessengerBot.Tests
{
    [TestFixture]
    public class BotConfigurationTests
    {
        [TestCase((string)null, "")]
        [TestCase(" ", "")]
        [TestCase(" username", "username")]
        [TestCase("\tusername", "username")]
        [TestCase("\rusername", "username")]
        [TestCase("\nusername", "username")]
        public void UserName_TrimsAwayWhitespace(string input, string expected)
        {
            var configuration = new BotConfiguration();

            configuration.Username = input;

            Assert.That(configuration.Username, Is.EqualTo(expected));
        }

        [TestCase((string)null, "")]
        [TestCase(" ", "")]
        [TestCase(" password", "password")]
        [TestCase("\tpassword", "password")]
        [TestCase("\rpassword", "password")]
        [TestCase("\npassword", "password")]
        public void Password_TrimsAwayWhitespace(string input, string expected)
        {
            var configuration = new BotConfiguration();

            configuration.Password = input;

            Assert.That(configuration.Password, Is.EqualTo(expected));
        }

        [Test]
        public void Password_RetainsValueGiven()
        {
            var configuration = new BotConfiguration();

            configuration.Password = "password";

            Assert.That(configuration.Password, Is.EqualTo("password"));
        }

        [Test]
        public void UserName_RetainsValueGiven()
        {
            var configuration = new BotConfiguration();

            configuration.Username = "username";

            Assert.That(configuration.Username, Is.EqualTo("username"));
        }
    }
}